MV_CC_CreateHandleWithoutLog

MV_CC_CreateHandleWithoutLog

Create a handle without log.

API Definition

int MV_CC_CreateHandleWithoutLog(
  void                       *handle,
  const MV_CC_DEVICE_INFO    *pstDevInfo
);

Parameters

handle

[OUT] Device handle

pstDevInfo

[IN] Device information, including device version, MAC address, transport layer type and other device information, see the structure MV_CC_DEVICE_INFO for details.

Return Value

Return MV_OK(0) on success, and return Error Code on failure.

Remarks

Create required resources within library and initialize internal module according to input device information. Create handle and call SDK interface through this interface, and SDK log file will not be created. To create logs, create handle through MV_CC_CreateHandle, and log files will be automatically generated and saved to MvSdkLog folder under current executable program path.

The following sample code is for reference only.

#include "MvCameraControl.h"

void main()
{
    int nRet = -1;
    void*  m_handle = NULL;

    //Enumerate all devices corresponding to specified transport protocol within subnet
    unsigned int nTLayerType = MV_GIGE_DEVICE | MV_USB_DEVICE;
    MV_CC_DEVICE_INFO_LIST m_stDevList = {0};
    int nRet = MV_CC_EnumDevices(nTLayerType, &m_stDevList);
    if (MV_OK != nRet)
    {
        printf("error: EnumDevices fail [%x]\n", nRet);
        return;
    }

    int i = 0;
    if (m_stDevList.nDeviceNum == 0)
    {
        printf("no camera found!\n");
        return;
    }

    //Select the first found online device and create device handle
    int nDeviceIndex = 0;

    MV_CC_DEVICE_INFO m_stDevInfo = {0};
    memcpy(&m_stDevInfo, m_stDevList.pDeviceInfo[nDeviceIndex], sizeof(MV_CC_DEVICE_INFO));

    nRet = MV_CC_CreateHandleWithoutLog(&m_handle, &m_stDevInfo);

    if (MV_OK != nRet)
    {
        printf("error: CreateHandleWithoutLog fail [%x]\n", nRet);
        return;
    }

    //...other processing
 
    //Destroy handle and release resource
    nRet = MV_CC_DestroyHandle(m_handle);
    if (MV_OK != nRet)
    {
        printf("error: DestroyHandle fail [%x]\n", nRet);
        return;
    }
}

MV_CC_CreateHandleWithoutLog

Create a handle without log.

API Definition

int MV_CC_CreateHandleWithoutLog(
  void                       *handle,
  const MV_CC_DEVICE_INFO    *pstDevInfo
);

Parameters

handle

[OUT] Device handle

pstDevInfo

[IN] Device information, including device version, MAC address, transport layer type and other device information, see the structure MV_CC_DEVICE_INFO for details.

Return Value

Return MV_OK(0) on success, and return Error Code on failure.

Remarks

Create required resources within library and initialize internal module according to input device information. Create handle and call SDK interface through this interface, and SDK log file will not be created. To create logs, create handle through MV_CC_CreateHandle, and log files will be automatically generated and saved to MvSdkLog folder under current executable program path.

The following sample code is for reference only.

#include "MvCameraControl.h"

void main()
{
    int nRet = -1;
    void*  m_handle = NULL;

    //Enumerate all devices corresponding to specified transport protocol within subnet
    unsigned int nTLayerType = MV_GIGE_DEVICE | MV_USB_DEVICE;
    MV_CC_DEVICE_INFO_LIST m_stDevList = {0};
    int nRet = MV_CC_EnumDevices(nTLayerType, &m_stDevList);
    if (MV_OK != nRet)
    {
        printf("error: EnumDevices fail [%x]\n", nRet);
        return;
    }

    int i = 0;
    if (m_stDevList.nDeviceNum == 0)
    {
        printf("no camera found!\n");
        return;
    }

    //Select the first found online device and create device handle
    int nDeviceIndex = 0;

    MV_CC_DEVICE_INFO m_stDevInfo = {0};
    memcpy(&m_stDevInfo, m_stDevList.pDeviceInfo[nDeviceIndex], sizeof(MV_CC_DEVICE_INFO));

    nRet = MV_CC_CreateHandleWithoutLog(&m_handle, &m_stDevInfo);

    if (MV_OK != nRet)
    {
        printf("error: CreateHandleWithoutLog fail [%x]\n", nRet);
        return;
    }

    //...other processing
 
    //Destroy handle and release resource
    nRet = MV_CC_DestroyHandle(m_handle);
    if (MV_OK != nRet)
    {
        printf("error: DestroyHandle fail [%x]\n", nRet);
        return;
    }
}